Optimal. Leaf size=61 \[ \frac{2 (b B-2 a C) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{d \sqrt{a-b} \sqrt{a+b}}+C x \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.115718, antiderivative size = 61, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 48, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.083, Rules used = {24, 2735, 2659, 205} \[ \frac{2 (b B-2 a C) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{d \sqrt{a-b} \sqrt{a+b}}+C x \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 24
Rule 2735
Rule 2659
Rule 205
Rubi steps
\begin{align*} \int \frac{a b B-a^2 C+b^2 B \cos (c+d x)+b^2 C \cos ^2(c+d x)}{(a+b \cos (c+d x))^2} \, dx &=\frac{\int \frac{b^2 (b B-a C)+b^3 C \cos (c+d x)}{a+b \cos (c+d x)} \, dx}{b^2}\\ &=C x+(b B-2 a C) \int \frac{1}{a+b \cos (c+d x)} \, dx\\ &=C x+\frac{(2 (b B-2 a C)) \operatorname{Subst}\left (\int \frac{1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{d}\\ &=C x+\frac{2 (b B-2 a C) \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a+b}}\right )}{\sqrt{a-b} \sqrt{a+b} d}\\ \end{align*}
Mathematica [A] time = 0.11916, size = 68, normalized size = 1.11 \[ \frac{2 (2 a C-b B) \tanh ^{-1}\left (\frac{(a-b) \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{b^2-a^2}}\right )}{d \sqrt{b^2-a^2}}+\frac{C (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.036, size = 108, normalized size = 1.8 \begin{align*} 2\,{\frac{C\arctan \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) }{d}}+2\,{\frac{bB}{d\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}\arctan \left ({\frac{ \left ( a-b \right ) \tan \left ( 1/2\,dx+c/2 \right ) }{\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}} \right ) }-4\,{\frac{aC}{d\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}\arctan \left ({\frac{ \left ( a-b \right ) \tan \left ( 1/2\,dx+c/2 \right ) }{\sqrt{ \left ( a+b \right ) \left ( a-b \right ) }}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.57174, size = 524, normalized size = 8.59 \begin{align*} \left [\frac{2 \,{\left (C a^{2} - C b^{2}\right )} d x +{\left (2 \, C a - B b\right )} \sqrt{-a^{2} + b^{2}} \log \left (\frac{2 \, a b \cos \left (d x + c\right ) +{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt{-a^{2} + b^{2}}{\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right )}{2 \,{\left (a^{2} - b^{2}\right )} d}, \frac{{\left (C a^{2} - C b^{2}\right )} d x -{\left (2 \, C a - B b\right )} \sqrt{a^{2} - b^{2}} \arctan \left (-\frac{a \cos \left (d x + c\right ) + b}{\sqrt{a^{2} - b^{2}} \sin \left (d x + c\right )}\right )}{{\left (a^{2} - b^{2}\right )} d}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.19159, size = 128, normalized size = 2.1 \begin{align*} \frac{{\left (d x + c\right )} C - \frac{2 \,{\left (\pi \left \lfloor \frac{d x + c}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )}{\sqrt{a^{2} - b^{2}}}\right )\right )}{\left (2 \, C a - B b\right )}}{\sqrt{a^{2} - b^{2}}}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]